package uz.rt.dicom.data;

import java.util.ArrayList;

public class ComparableList<V extends Comparable<? super V>> extends ArrayList<V> implements Comparable<ComparableList>
{
// ------------------------ INTERFACE METHODS ------------------------


// --------------------- Interface Comparable ---------------------

    @SuppressWarnings("unchecked")
    public int compareTo(ComparableList o)
    {
        if (this.size() != o.size()) return Integer.compare(size(), o.size());
        for (int i = 0; i < size(); i++)
        {
            if (get(i) != o.get(i)) return get(i).compareTo((V) o.get(i));
        }
        return 0;
    }
}
